<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>组合产品详情productDetail</title>
	</head>
	<link rel="stylesheet" href="../css/common.css" />
	<link rel="stylesheet" href="../css/less/common_less.css" />
	<style>
		body{
		background:white;
		}
		input{
			font-family:"微软雅黑";
		}
		body{
			padding-bottom:20px;
		}
		.title{
			height:45px;
			line-height:45px;
			margin-left:4px;
			font-size:14px;
			font-weight:900;
		}
		.quare{
			margin:0 7px 0 11px;
			position:relative;
			top:3px;
			display:inline-block;
			width:4px;
			height:16px;
			background:#00aa98;
		}
		.addFlightRoute{
			background:#f9a61a;
			float:right;
			margin-right:24px;
			margin-top:9px;
		}
		.flightList{
			margin-left:4px;
			width:1140px;
			background:white;
		}
		.flightList .flight{
			width:1125px;
			
		}
		.flight_Content{
			width:1105px;
			margin-left:20px;
		}
		.flight_Content input{
			width:100%;
			height:100%;
			border:none;
			text-align:center;
		}
		.flight_Content .smallTitle{
			height:38px;
			line-height:38px;
			font-weight:900;
		}
		.flight_Content table{
			border-collapse:collapse;
			width:1105px;
		}
		.flight_Content table th{
			background:#f0eeef;
		}
		.flight_Content table th:nth-of-type(1){
			width:90px;	
		}
		.flight_Content table th:nth-of-type(2){
			width:260px;	
		}
		.flight_Content table th:nth-of-type(3){
			width:270px;	
		}
		.flight_Content table th:nth-of-type(4){
			width:120px;	
		}
		.flight_Content table th:nth-of-type(5){
			width:120px;	
		}
		.flight_Content table th:nth-of-type(6){
			width:120px;	
		}
		.flight_Content table th:nth-of-type(7){
			width:100px;	
		}
		
		.flight_Content table td,th{
			border:1px solid #e7e7e7;
			height:30px;
			text-align:center;
		}
		.schedule{
			border-top:1px solid white;
			width:1140px;
			background:white;
			margin-left:4px;
			padding-bottom:5px;
		}
		.schedule table{
			margin:20px 20px;
		}
		.schedule table td{
			text-align:center;
			border:1px solid #e7e7e7;
		}
		.pricePlan{
			height:45px;
			line-height:45px;
			padding-left:20px;
			margin-left:4px;
			width:1120px;
			background:white;
		}
		.productDetail{
			border-top:1px solid #e7e7e7;
			width:1140px;
			background:white;
			margin-left:4px;
			padding-bottom:20px;
		}
		.productDetail table{
			margin:20px 0 0 20px;
			width:1105px;
			
		}
		.total{
			margin-right:25px;
			float:right;
			font-weight:normal;
		}
		.productDetail table th{
			height:35px;
		}
		.productDetail table td{
			height:40px;
			background:white;
			border:1px solid #e7e7e7;
		}
		
		.planNo{
			margin-left:30px;
		}
		.connectMess,.upSeatMess{
			width:1120px;
			height:50px;
			background:white;
			margin-left:4px;
			padding-left:20px;
			line-height:50px;
			display:none;
		}
		.connectMess input,.upSeatMess input{
			border:none;
			outline:none;
			width:1000px;
			height:50px;
			padding-left:10px;
			font-family:"微软雅黑";		
		}
		.scheduleTable_1{
			width:1050px;
		}
		.scheduleTable_2{
			width:500px;
		}
		table td{
			height:30px;
			border:1px solid #e1e1eb;
		}
		.singleDetail{
			width:1140px;
			background:white;
			margin-left:4px;
		}
		.singleDetail{
			padding:20px 0;
		}
		.singleDetailTable{
			width:1105px;
			margin-left:20px;
		}
		.scheduleTable_3{
			height:53px;
			line-height:53px;
			width:1120px;
			background:white;
		}
		.scheduleTable_3 .autoRule{
			height:53px;
			width:1000px;
			margin-left:10px;
			outline:none;
			border:none;
		}
		.scheduleTable_3>span{
			margin-left:20px;
		}
		.showAndHideP{
			height:30px;
			line-height:30px;
			text-align:center;
			color:#faa001;
			border:1px solid #e1e1eb;
			border-top:none;
			width:1120px;
		}
		.showAndHide{
			cursor:pointer;
		}
		.hideTr{
			display:none;
		}
		.freePlanNo{
			margin-left:30px;
		}
		.MWinterval{
			height:38px;
			line-height:38px;
			color:#00aa98;
			padding-left:20px;
		}
	</style>
	<body>
		<p class='title f60666'>
			<span><i class='quare'></i>航班信息</span>
		</p>
		<div class='flightList'>
				
		</div>
		<p class='connectMess'>联运  <input readonly class='conInput' type='text' placeholder='联程信息'/></p>
		<p class='upSeatMess'>升舱  <input readonly class='upSeatInput' type='text' placeholder='升舱信息'/></p>
		<p class='title scheduleTitle'>
			<span><i class='quare'></i>组合排期</span>
		</p>
		<div class='schedule'>
			<table class='scheduleTable_1'>
					<tr>	
						<th>排期编号</th>					
						<th>本航程</th>
						<th>间隔周数</th>
						<th>下一航程</th>
					</tr>
			</table>
		
		
			<table class='scheduleTable_2'>
				<tr style='background:#f1f1f1;'>
					<th>第1程起始</th>
					<th>去程间隔天数</th>
					<th>回程间隔天数</th>
				</tr>
				<tr>
					<td class='schedule4'></td>
					<td class='schedule5'></td>
					<td class='schedule6'></td>
				</tr>
			</table>
			<div class='scheduleTable_3'>
				<span>规则<input readonly class='autoRule' type='text'/></span>
			</div>	
		</div>
		<p class='title f60666'>
			<span><i class='quare'></i>运价方案</span>
		</p>
		<div class='pricePlan f868686'><b style="color:#00aa98">票损运价</b>—适用运价方案编号<span class='planNo'></span></div>
		<div class='pricePlan f868686'><b style="color:#00aa98">免票运价</b>—适用运价方案编号<span class='freePlanNo'></span></div>
		<p class='title'>
			<span class='f60666'><i class='quare'></i>产品明细</span>
			<span class='total f868686'>共<sapn  class='totalDetail fa2828'></sapn>个产品明细</span>
		</p>
		<div class='productDetail'>
			<table>
				<tr style='background:#f1f1f1;' class="f868686">
					<th>序号</th>
					<th>航班号</th>
					<th>出发机场</th>
					<th>到达机场</th>
					<th>出发日期</th>
					<th>出发时间</th>
					<th>到达日期</th>
					<th>到达时间</th>
					<th class="travelTime">行程时间</th>
				</tr>
				<tbody class='clear'></tbody>
			</table>
		</div>
		<p class='title singleTitle '>
			<span><i class='quare '></i>单边明细</span>
		</p>
		<div class='singleDetail'>
			<table class='singleDetailTable'>
				<tr class="f868686">
					<th>序号</th>
					<th>航班号</th>
					<th>出发机场</th>
					<th>到达机场</th>
					<th>开始日期</th>
					<th>出发时间</th>
					<th>到达时间</th>
				</tr>
				<tbody class='clear2'>
					
				</tbody>
			</table>
		</div>
	</body>
		<script type="text/javascript" src="../js/jquery-1.12.4.js" ></script>
		<script type="text/javascript" src="../js/common.js" ></script>
		<script type="text/javascript" src="../layer-v2.4/layer/layer.js" ></script>
			<!-- 引入my97日期时间控件 -->
		<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js" charset="utf-8"></script>	
		<script>
			var proId = getHref().proId
			$.get("../product/"+proId+"/showdetail",function(data){
				data = JSON.parse(data);
				flightDraw(data.data)
				/* console.log(data)
				var No = 0;
				for(var i=0;i<data.data.productItineraryVo.length;i++){
					var str="";
					No++
					str+="<div class='flight'>"+
							"<div class='flight_Content'>"+
							"<p>"+
								"<span class='smallTitle f868686'> 第  "+No+" 程航班</span>"+
							"</p>"+
							"<table>"+
								"<tr class='f868686'>"+
									"<th>航班号</th>"+
									"<th>出发机场</th>"+
									"<th>到达机场</th>"+
									"<th>出发日期</th>"+
									"<th>到达日期</th>"+
									"<th>出发时间</th>"+
									"<th>到达时间</th>"+
								"</tr>"
								
					for(var j=0;j<data.data.productItineraryVo[i].length;j++){
						if(j==0){                             //第一个tr不被隐藏
							str+="<tr class='f60666'>" +
							 "<td>"+data.data.productItineraryVo[i][j].airlineCode+"</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].depCn+"("+data.data.productItineraryVo[i][j].depAirport+")</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].arrCn+"("+data.data.productItineraryVo[i][j].arrAirport+")</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].availableDate+"</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].unavailableDate+"</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].depTime+"</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].arrTime+"</td>" +
						 "</tr>" 	
						}else{
							str+="<tr class='hideTr f60666'>" +
							 "<td>"+data.data.productItineraryVo[i][j].airlineCode+"</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].depCn+"("+data.data.productItineraryVo[i][j].depAirport+")</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].arrCn+"("+data.data.productItineraryVo[i][j].arrAirport+")</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].availableDate+"</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].unavailableDate+"</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].depTime+"</td>" +
							 "<td>"+data.data.productItineraryVo[i][j].arrTime+"</td>" +
						 "</tr>" 	
						}					
					}			
						str+="</table>"+
							 "<p class='showAndHideP faa000'><span class=showAndHide>查看更多<span></p>"+
						"</div>"+					
					"</div>"
					$(".flightList").append(str)
					
				} */
				//组合排期
				if(data.data.schType=="WK"){
					$(".scheduleTable_2").hide();
					$(".scheduleTable_3").hide();
					var len = data.data.productScheduleVo.length
					for(var n=0;n<len;n++){
						addSchedule()
						countNumber()
						$(".scheduleTable_1 .thisDate").eq(n).text(commomFun.numToWeekStr(data.data.productScheduleVo[n].thisDate))
						$(".scheduleTable_1 .itval").eq(n).text(commomFun.WeekStr(data.data.productScheduleVo[n].itval))
						$(".scheduleTable_1 .nextDate").eq(n).text(commomFun.numToWeekStr(data.data.productScheduleVo[n].nextData))
					}
					
				}if(data.data.schType=="IV"){
					$(".scheduleTable_1").hide();
					$(".scheduleTable_3").hide();
					$(".schedule4").text(data.data.productScheduleVo[0].thisDate)
					$(".schedule5").text(data.data.productScheduleVo[0].itval)
					$(".schedule6").text(data.data.productScheduleVo[0].nextData)
				}if(data.data.schType=="AUTO"){
					$(".scheduleTable_1").hide();
					$(".scheduleTable_2").hide();
					var autoThisDate = JSON.parse(data.data.productScheduleVo[0].thisDate).join("/");																	
					$(".autoRule").val(autoThisDate);
				}if(!data.data.schType){
					$(".scheduleTitle").css("display","none");
					$(".schedule").css("display","none");
				}
				
				//适用运价方案编号
				$(".planNo").text(data.data.fareName)
				//免票运价方案
				if(data.data.freeFareId){
					$(".freePlanNo").text(data.data.freeFareId)
				}else{
					$(".freePlanNo").parent().hide();
				}
				//联程信息
				if(data.data.connectFltInfo!=""&&data.data.connectFltInfo!=null&&data.data.connectFltInfo!="undefined"){
					$(".conInput").val(data.data.connectFltInfo)
					$(".connectMess").css("display","block")
				}
				//升舱信息
				if(data.data.seatUp!=""&&data.data.seatUp!=null&&data.data.seatUp!="undefined"){
					$(".upSeatInput").val(data.data.seatUp)
					$(".upSeatMess").css("display","block")
				}
				//产品明细
				$(".totalDetail").text(data.data.subProductDetailVos.length)
				var str = "";	
				var number = 0;
				for(var i=0;i<data.data.subProductDetailVos.length;i++){
					number++
					var len = data.data.subProductDetailVos[i].length
					for(var j=0;j<len;j++){						
						if(j==0){
							str+="<tr class='f60666'><td rowspan="+len+">"+number+"</td>"								
						}else{
							str+="";
						}														
					   	   str+="<td>"+data.data.subProductDetailVos[i][j].airlineCode+"</td>"+
								"<td>"+data.data.subProductDetailVos[i][j].depCn+"("+data.data.subProductDetailVos[i][j].depAirport+")</td>"+
								"<td>"+data.data.subProductDetailVos[i][j].arrCn+"("+data.data.subProductDetailVos[i][j].arrAirport+")</td>"+
								"<td>"+data.data.subProductDetailVos[i][j].depDate+"</br>("+dateToWeek(data.data.subProductDetailVos[i][j].depDate)+")</td>"+
								"<td>"+data.data.subProductDetailVos[i][j].depTime+"</td>"+
								"<td>"+data.data.subProductDetailVos[i][j].arrDate+"</br>("+dateToWeek(data.data.subProductDetailVos[i][j].arrDate)+")</td>"+
								"<td>"+data.data.subProductDetailVos[i][j].arrTime+"</td>"
						if(j==0){
							if(len=="1"){                              //单程无行程
								$(".travelTime").hide();
							}else{                                     //往返计算行程时间
								str+="<td rowspan="+len+">"+(getDaysInterval(data.data.subProductDetailVos[i][j].depDate,data.data.subProductDetailVos[i][len/2].depDate)+1)+"</td>"
							}
							
						}
							str+="</tr>" 			
					}
				}
				$(".clear").append(str)
				//单边明细
				if(data.data.singles.length==0){
					$(".singleDetail").hide();
					$(".singleTitle").hide();
				}else{
					var singles = data.data.singles;					
					for(var i=0;i<singles.length;i++){
						var str="";
						str+="<tr>"+
								"<td>"+(i+1-0)+"</td>"+
								"<td>"+singles[i].airlineCode+"</td>"+
								"<td>"+singles[i].depCn+"("+singles[i].depAirport+")</td>"+
								"<td>"+singles[i].arrCn+"("+singles[i].arrAirport+")</td>"+
								"<td>"+singles[i].depDate+"</td>"+
								"<td>"+singles[i].depTime+"</td>"+								
								"<td>"+singles[i].arrTime+"</td>"+
							 "</tr>"
						$(".clear2").append(str)
					}
				}
		})
//_____________________________________________________________________________按星期排期函数
	function addSchedule(){
		var str="";
		str+="<tr>"+
						"<td class='scheduleNo'></td>"+
						"<td class='thisDate'></td>"+
						"<td class='itval'></td>"+
						"<td class='nextDate'></td>"+
					"</tr>"
		$(".scheduleTable_1").append(str)
	}
//———————————————————————————————————————————————————————————————————————————————序号计算
		function countNumber(){
			var len = $(".scheduleNo").length;
			for(var i=0;i<len;i++){
				$(".scheduleNo").eq(i).text(i+1)
			}
		}
//————————————————————————————————————————————————————————————————————————————————查看更多
		$(".flightList").delegate(".showAndHide","click",function(){	
			$(this).parent().parent().find(".hideTr").toggle(500);	
			if($(this).text()=="查看更多"){
				$(this).text("收起")
			}else{
				$(this).text("查看更多")
			}
		})
//________________________________________________________________________________航班展示
		function flightDraw(data){
			if(data.returnType=="MW"){
				for(var i=0;i<data.productItineraryVo.length;i++){
					var str="";
					str+="<div class='flight'>"+
							"<div class='flight_Content'>"+
							"<p>"+
								"<span class='smallTitle f868686'> 第"+(i+1-0)+"程航班</span>"+
							"</p>"+
							"<table>"+
								"<tr class='f868686'>"+
									"<th>航班号</th>"+
									"<th>出发机场</th>"+
									"<th>到达机场</th>"+
									"<th>出发日期</th>"+
									"<th>到达日期</th>"+
									"<th>出发时间</th>"+
									"<th>到达时间</th>"+
								"</tr>"
								
					for(var j=0;j<data.productItineraryVo[i].length;j++){
						if(j==0){                             //第一个tr不被隐藏
							str+="<tr class='f60666'>" +
							 "<td>"+data.productItineraryVo[i][j].airlineCode+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].depCn+"("+data.productItineraryVo[i][j].depAirport+")</td>" +
							 "<td>"+data.productItineraryVo[i][j].arrCn+"("+data.productItineraryVo[i][j].arrAirport+")</td>" +
							 "<td>"+data.productItineraryVo[i][j].availableDate+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].unavailableDate+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].depTime+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].arrTime+"</td>" +
						 "</tr>" 	
						}else{
							str+="<tr class='hideTr f60666'>" +
							 "<td>"+data.productItineraryVo[i][j].airlineCode+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].depCn+"("+data.productItineraryVo[i][j].depAirport+")</td>" +
							 "<td>"+data.productItineraryVo[i][j].arrCn+"("+data.productItineraryVo[i][j].arrAirport+")</td>" +
							 "<td>"+data.productItineraryVo[i][j].availableDate+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].unavailableDate+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].depTime+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].arrTime+"</td>" +
						 "</tr>" 	
						}					
					}			
						str+="</table>"+
							 "<p class='showAndHideP faa000'><span class=showAndHide>查看更多<span></p>"+
						"</div>"	
					if(i==1){
						str+="<div class='MWinterval'>间隔天数 "+commomFun.toEmptyString(data.fi)+"<div>"
					}
					if(i==3){
						str+="<div class='MWinterval'>间隔天数 "+commomFun.toEmptyString(data.si)+"<div>"
					}
					str+="</div>"
					$(".flightList").append(str);
				}
			}else{
				var No = 0;
				for(var i=0;i<data.productItineraryVo.length;i++){
					var str="";
					No++
					str+="<div class='flight'>"+
							"<div class='flight_Content'>"+
							"<p>"+
								"<span class='smallTitle f868686'> 第  "+No+" 程航班</span>"+
							"</p>"+
							"<table>"+
								"<tr class='f868686'>"+
									"<th>航班号</th>"+
									"<th>出发机场</th>"+
									"<th>到达机场</th>"+
									"<th>出发日期</th>"+
									"<th>到达日期</th>"+
									"<th>出发时间</th>"+
									"<th>到达时间</th>"+
								"</tr>"
								
					for(var j=0;j<data.productItineraryVo[i].length;j++){
						if(j==0){                             //第一个tr不被隐藏
							str+="<tr class='f60666'>" +
							 "<td>"+data.productItineraryVo[i][j].airlineCode+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].depCn+"("+data.productItineraryVo[i][j].depAirport+")</td>" +
							 "<td>"+data.productItineraryVo[i][j].arrCn+"("+data.productItineraryVo[i][j].arrAirport+")</td>" +
							 "<td>"+data.productItineraryVo[i][j].availableDate+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].unavailableDate+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].depTime+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].arrTime+"</td>" +
						 "</tr>" 	
						}else{
							str+="<tr class='hideTr f60666'>" +
							 "<td>"+data.productItineraryVo[i][j].airlineCode+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].depCn+"("+data.productItineraryVo[i][j].depAirport+")</td>" +
							 "<td>"+data.productItineraryVo[i][j].arrCn+"("+data.productItineraryVo[i][j].arrAirport+")</td>" +
							 "<td>"+data.productItineraryVo[i][j].availableDate+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].unavailableDate+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].depTime+"</td>" +
							 "<td>"+data.productItineraryVo[i][j].arrTime+"</td>" +
						 "</tr>" 	
						}					
					}			
						str+="</table>"+
							 "<p class='showAndHideP faa000'><span class=showAndHide>查看更多<span></p>"+
						"</div>"+					
					"</div>"
					$(".flightList").append(str);
				}
			}
		}
		</script>		
</html>
